home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
dns
/
e164.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
2KB
|
48 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
import dns.exception as dns
import dns.name as dns
import dns.resolver as dns
public_enum_domain = dns.name.from_text('e164.arpa.')
def from_e164(text, origin = public_enum_domain):
parts = _[1]
parts.reverse()
return dns.name.from_text('.'.join(parts), origin = origin)
def to_e164(name, origin = public_enum_domain, want_plus_prefix = True):
if origin is not None:
name = name.relativize(origin)
dlabels = _[1]
dlabels.reverse()
text = ''.join(dlabels)
if want_plus_prefix:
text = '+' + text
return text
def query(number, domains, resolver = None):
if resolver is None:
resolver = dns.resolver.get_default_resolver()
for domain in domains:
if isinstance(domain, (str, unicode)):
domain = dns.name.from_text(domain)
qname = dns.e164.from_e164(number, domain)
try:
return dns.resolver.query(qname, 'NAPTR')
continue
except dns.resolver.NXDOMAIN:
continue
raise dns.resolver.NXDOMAIN